<%-- 
    Document   : Address
    Created on : 2020-4-18, 20:48:13
    Author     : zhang
--%>

<%@page import="dao.AddressDao"%>
<%@page import="entity.Address"%>
<%@page import="java.util.List"%>
<%@page import="entity.Member"%>
<%@page import="dao.MemberDao"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%
            String name=(String)session.getAttribute("username");
            Member member=new MemberDao().getMemberByName(name);
            List<Address> list=new AddressDao().getAllUndeletedAddress(member.getId());
        %>
        <h1>管理收货地址</h1>
        <div style="position: absolute;left:500px"><a href="Member.jsp?name=<%=name%>">返回个人主页</a></div>
        <h3><a href="AddAddress.jsp?name=<%=name%>">添加收货地址</a></h3>
        <%
            for(int i=0;i<list.size();i++){
        %>
        <div>
            <h3>地址<%=i+1%></h3>
            <p>详细地址：<%=list.get(i).getAddress()%></p>
            <p>收件人：<%=list.get(i).getAddressee()%></p>
            <p>电话：<%=list.get(i).getPhone()%></p>
            <p>邮编：<%=list.get(i).getZipcode()%></p>
            <h3><a href="das?id=<%=list.get(i).getId()%>&name=<%=name%>">删除地址</a></h3>
        </div><br>
        <%
            }
        %>
    </body>
</html>
